import {createSlice} from '@reduxjs/toolkit';

const countSlice = createSlice({
    name: 'count',
    initialState: {
        count: 0,
    },
    reducers: {
        addNumber(state, action) {
            state.count = state.count + action.payload;
        },
        subNumber(state, {payload}) {
            state.count = state.count - payload
        }
    }
})

export const {addNumber, subNumber} = countSlice.actions;
export default countSlice.reducer;